package ${rootPkg}.fegin;

import ${rootPkg}.entity.${bClassName};
import ${rootPkg}.hystrix.${bClassName}Hystrix;
import com.unbox.common.configuration.fegin.FeignRequestInterceptor;
import com.unbox.common.response.UnboxResponse;
import com.unbox.common.table.UnBoxPage;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.cloud.openfeign.SpringQueryMap;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
import java.util.List;

/**
 * <p>
    * <${tableComment}业务熔断配置
        * </p>
 *
 * @author 王振宇
 * @since ${.now?string('yyyy-MM-dd')}
 */
@FeignClient(value = "${feignServiceName}" , configuration = FeignRequestInterceptor.class, fallback = ${bClassName}Hystrix.class)
public interface ${bClassName}Fegin {

    /**
     * 分页查询
     *
     * @param ${sClassName}
     * @param pageNo
     * @param pageSize
     * @return
     */
    @GetMapping(value = "/${apiVersion}/${sClassName}/getPageList", consumes = MediaType.APPLICATION_JSON_VALUE)
    UnboxResponse<UnBoxPage> getPageList(@SpringQueryMap ${bClassName} ${sClassName}, @RequestParam("pageNo") Integer pageNo, @RequestParam("pageSize") Integer pageSize);

    /**
     * 查询列表
     *
     * @param ${sClassName}
     * @return
     */
    @GetMapping(value = "/${apiVersion}/${sClassName}/getList", consumes = MediaType.APPLICATION_JSON_VALUE)
    UnboxResponse<List<${bClassName}>> getList(@SpringQueryMap ${bClassName} ${sClassName});

    /**
     * 详情
     *
     * @param ${sClassName}
     * @return
     */
    @GetMapping(value = "/${apiVersion}/${sClassName}/info", consumes = MediaType.APPLICATION_JSON_VALUE)
    UnboxResponse<${bClassName}> info(@SpringQueryMap ${bClassName} ${sClassName});

    /**
     * 通过id数据查询数据
     *
     * @param ids
     * @return
     */
    @GetMapping(path = "/${apiVersion}/${sClassName}/ids${bClassName}s", consumes = MediaType.APPLICATION_JSON_VALUE)
    UnboxResponse<List<${bClassName}>> ids${bClassName}s(@SpringQueryMap List<Integer> ids);

    /**
     * 保存数据
     *
     * @param ${sClassName}
     * @return
     */
    @PostMapping("/${apiVersion}/${sClassName}/save")
    UnboxResponse<Boolean> save(@RequestBody ${bClassName} ${sClassName});

    /**
     * 批量添加
     *
     * @param ${sClassName}s
     * @return
     */
    @PostMapping("/${apiVersion}/${sClassName}/saveBatch")
    UnboxResponse<Boolean> batchSave(@RequestBody List<${bClassName}> ${sClassName}s);

    /**
     * 修改数据
     *
     * @param ${sClassName}
     * @return
     */
    @PutMapping("/${apiVersion}/${sClassName}/update")
    UnboxResponse<Boolean> update(@RequestBody ${bClassName} ${sClassName});

    /**
     * 批量修改
     *
     * @param ${sClassName}s
     * @return
     */
    @PutMapping("/${apiVersion}/${sClassName}/updateBatch")
    UnboxResponse<Boolean> batchUpdate(@RequestBody List<${bClassName}> ${sClassName}s);

    /**
     * 删除数据
     *
     * @param ${sClassName}
     * @return
     */
    @DeleteMapping("/${apiVersion}/${sClassName}/delete")
    UnboxResponse<Boolean> delete(@RequestBody ${bClassName} ${sClassName});

    /**
     * 批量删除
     *
     * @param ids
     * @return
     */
    @DeleteMapping("/${apiVersion}/${sClassName}/deleteBatch")
    UnboxResponse<Boolean> deleteBatch(@RequestBody List<Integer> ids);

}
